//
//  PLColor.h
//  PlatformCommon
//
//  Created by KimmanYip on 2019/3/22.
//  Copyright © 2019 KimmanYip. All rights reserved.
//

/*
 * 快速生成UIColor对象的宏
 */

#ifndef PLColor_h
#define PLColor_h

/*
 *通过rgba获取颜色
 *
 *@param r 取值范围为0-255
 *@param g 取值范围为0-255
 *@param b 取值范围为0-255
 *@param a 取值范围为0-1
 *@return UIColor对象
 */

#define ColorWithRGBA(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:a]

/*
 *通过rgb获取颜色，alpha为1
 */
#define ColorWithRGB(r, g, b) ColorWithRGBA(r, g, b, 1.0)

/*
 *通过十六进制获取颜色, ColorWithHex(0xeeeeee)
 */
#define ColorWithHexA(hexValue, a) [UIColor colorWithRed:((float)((hexValue & 0xFF0000) >> 16)) / 255.0 green:((float)((hexValue & 0xFF00) >> 8)) / 255.0 blue:((float)(hexValue & 0xFF)) / 255.0 alpha:a]

/*
 *通过十六进制获取颜色，alpha为1
 */
#define ColorWithHex(hexValue) ColorWithHexA(hexValue, 1.0)



#endif /* PLColor_h */
